#!/bin/bash
clear

TEXT='\033[30;107;2m'
INFO='\033[97;44m'
WARNING='\033[97;43m'
ERROR='\033[97;41m'
SUCCESS='\033[97;42m'

GREEN='\033[92m'
YELLOW='\033[93m'
RESET='\033[0m'

if [ "${EUID}" -ne 0 ]; then
    echo -e "${ERROR} RALAT ${RESET}${TEXT} Anda perlu menjalankan skrip ini sebagai root! ${RESET}"; exit 1
fi

echo
echo -e "${TEXT} DROPBEAR & OPENVPN                                         ${RESET}"
echo
echo -e "[01] ${GREEN}trial${RESET}          - ${YELLOW}Buat akaun percubaan${RESET}"
echo -e "[02] ${GREEN}create${RESET}         - ${YELLOW}Tambah akaun pengguna${RESET}"
echo -e "[03] ${GREEN}renew${RESET}          - ${YELLOW}Perbaharui akaun pengguna${RESET}"
echo -e "[04] ${GREEN}login${RESET}          - ${YELLOW}Senarai pengguna log masuk${RESET}"
echo -e "[05] ${GREEN}lists${RESET}          - ${YELLOW}Senaraikan akaun pengguna${RESET}"
echo -e "[06] ${GREEN}lock${RESET}           - ${YELLOW}Kunci/Lumpuhkan akaun pengguna${RESET}"
echo -e "[07] ${GREEN}unlock${RESET}         - ${YELLOW}Buka kunci/Dayakan akaun pengguna${RESET}"
echo -e "[08] ${GREEN}delete${RESET}         - ${YELLOW}Padam akaun pengguna${RESET}"
echo
echo -e "${TEXT} SHADOWSOCKS-LIBEV                                          ${RESET}"
echo
echo -e "[09] ${GREEN}add-ss${RESET}         - ${YELLOW}Tambah akaun pengguna${RESET}"
echo -e "[10] ${GREEN}renew-ss${RESET}       - ${YELLOW}Perbaharui akaun pengguna${RESET}"
echo -e "[11] ${GREEN}list-ss${RESET}        - ${YELLOW}Senaraikan akaun pengguna${RESET}"
echo -e "[12] ${GREEN}enable-ss${RESET}      - ${YELLOW}Buka kunci/Dayakan akaun pengguna${RESET}"
echo -e "[13] ${GREEN}disable-ss${RESET}     - ${YELLOW}Kunci/Lumpuhkan akaun pengguna${RESET}"
echo -e "[14] ${GREEN}delete-ss${RESET}      - ${YELLOW}Padam akaun pengguna${RESET}"
echo
echo -e "${TEXT} V2RAY                                                      ${RESET}"
echo
echo -e "[15] ${GREEN}add-trojan${RESET}     - ${YELLOW}Tambah akaun pengguna${RESET}"
echo -e "[16] ${GREEN}renew-trojan${RESET}   - ${YELLOW}Perbaharui akaun pengguna${RESET}"
echo -e "[17] ${GREEN}list-trojan${RESET}    - ${YELLOW}Senaraikan akaun pengguna${RESET}"
echo -e "[18] ${GREEN}delete-trojan${RESET}  - ${YELLOW}Padam akaun pengguna${RESET}"
echo
echo -e "[19] ${GREEN}add-vless${RESET}      - ${YELLOW}Tambah akaun pengguna${RESET}"
echo -e "[20] ${GREEN}renew-vless${RESET}    - ${YELLOW}Perbaharui akaun pengguna${RESET}"
echo -e "[21] ${GREEN}list-vless${RESET}     - ${YELLOW}Senaraikan akaun pengguna${RESET}"
echo -e "[22] ${GREEN}delete-vless${RESET}   - ${YELLOW}Padam akaun pengguna${RESET}"
echo
echo -e "[23] ${GREEN}add-vmess${RESET}      - ${YELLOW}Tambah akaun pengguna${RESET}"
echo -e "[24] ${GREEN}renew-vmess${RESET}    - ${YELLOW}Perbaharui akaun pengguna${RESET}"
echo -e "[25] ${GREEN}list-vmess${RESET}     - ${YELLOW}Senaraikan akaun pengguna${RESET}"
echo -e "[26] ${GREEN}delete-vmess${RESET}   - ${YELLOW}Padam akaun pengguna${RESET}"
echo
echo -e "${TEXT} XRAY                                                       ${RESET}"
echo
echo -e "[27] ${GREEN}add-xray${RESET}       - ${YELLOW}Tambah akaun pengguna${RESET}"
echo -e "[28] ${GREEN}renew-xray${RESET}     - ${YELLOW}Perbaharui akaun pengguna${RESET}"
echo -e "[29] ${GREEN}list-xray${RESET}      - ${YELLOW}Senaraikan akaun pengguna${RESET}"
echo -e "[30] ${GREEN}delete-xray${RESET}    - ${YELLOW}Padam akaun pengguna${RESET}"
echo
echo -e "${TEXT} WIREGUARD                                                  ${RESET}"
echo
echo -e "[31] ${GREEN}add-wg${RESET}         - ${YELLOW}Tambah akaun pengguna${RESET}"
echo -e "[32] ${GREEN}renew-wg${RESET}       - ${YELLOW}Perbaharui akaun pengguna${RESET}"
echo -e "[33] ${GREEN}list-wg${RESET}        - ${YELLOW}Senaraikan akaun pengguna${RESET}"
echo -e "[34] ${GREEN}delete-wg${RESET}      - ${YELLOW}Padam akaun pengguna${RESET}"
echo
echo -e "${TEXT} SERVICES                                                   ${RESET}"
echo
echo -e "[35] ${GREEN}dropbear${RESET}       - ${YELLOW}Menu perkhidmatan Dropbear${RESET}"
echo -e "[36] ${GREEN}openvpn${RESET}        - ${YELLOW}Menu perkhidmatan OpenVPN${RESET}"
echo -e "[37] ${GREEN}libev${RESET}        - ${YELLOW}Menu perkhidmatan Shadowsocks${RESET}"
echo -e "[38] ${GREEN}v2ray${RESET}          - ${YELLOW}Menu perkhidmatan v2ray${RESET}"
echo -e "[39] ${GREEN}xray${RESET}           - ${YELLOW}Menu perkhidmatan xray${RESET}"
echo -e "[40] ${GREEN}wireguard${RESET}      - ${YELLOW}Menu perkhidmatan wireguard${RESET}"
echo -e "[41] ${GREEN}websocket${RESET}      - ${YELLOW}Menu perkhidmatan websocket${RESET}"
echo -e "[42] ${GREEN}squid${RESET}          - ${YELLOW}Menu perkhidmatan Squid3${RESET}"
echo -e "[43] ${GREEN}stunnel${RESET}        - ${YELLOW}Menu perkhidmatan Stunnel4${RESET}"
echo
echo -e "${TEXT} SERVER                                                     ${RESET}"
echo
echo -e "[44] ${GREEN}detail${RESET}         - ${YELLOW}Tunjukkan perincian server${RESET}" # WARNING
echo -e "[45] ${GREEN}tcpbbr${RESET}         - ${YELLOW}Tweak Protocol TCP BBR${RESET}"
echo -e "[46] ${GREEN}shaper${RESET}         - ${YELLOW}Hadkan muat turun/muat naik${RESET}"
echo -e "[47] ${GREEN}speedtest${RESET}      - ${YELLOW}Uji kelajuan pelayan${RESET}"
echo
echo -e "${TEXT} ---------------------------------------------------------- ${RESET}"
echo -e "${TEXT} Dicipta oleh Doctype, Dikuasakan oleh Cybertize.           ${RESET}"
echo -e "${TEXT} ========================================================== ${RESET}"
echo

read -p "Masukkan pilihan anda atau 'quit' untuk keluar: " _choice
case $_choice in
    # sshd & openvpn
    01 | trial)
        bash /usr/local/plugins/trial.sh
        ;;
    02 | create)
        bash /usr/local/plugins/create.sh
        ;;
    03 | renew)
        bash /usr/local/plugins/renew.sh
        ;;
    04 | login)
        bash /usr/local/plugins/login.sh
        ;;
    05 | lists)
        bash /usr/local/plugins/lists.sh
        ;;
    06 | lock)
        bash /usr/local/plugins/lock.sh
        ;;
    07 | unlock)
        bash /usr/local/plugins/unlock.sh
        ;;
    08 | delete)
        bash /usr/local/plugins/delete.sh
        ;;
        # shadowsocks
    09 | add-ss)
        bash /usr/local/plugins/add-ss.sh
        ;;
    10 | renew-ss)
        bash /usr/local/plugins/renew-ss.sh
        ;;
    11 | list-ss)
        bash /usr/local/plugins/lists-ss.sh
        ;;
    12 | enable-ss)
        bash /usr/local/plugins/enable-ss.sh
        ;;
    13 | disable-ss)
        bash /usr/local/plugins/disable-ss.sh
        ;;
    14 | delete-ss)
        bash /usr/local/plugins/delete-ss.sh
        ;;
        # v2ray
    15 | add-trojan)
        bash /usr/local/plugins/add-trojan.sh
        ;;
    16 | renew-trojan)
        bash /usr/local/plugins/renew-trojan.sh
        ;;
    17 | list-trojan)
        bash /usr/local/plugins/lists-trojan.sh
        ;;
    18 | delete-trojan)
        bash /usr/local/plugins/delete-trojan.sh
        ;;
    19 | add-vless)
        bash /usr/local/plugins/add-vless.sh
        ;;
    20 | renew-vless)
        bash /usr/local/plugins/renew-vless.sh
        ;;
    21 | list-vless)
        bash /usr/local/plugins/lists-vless.sh
        ;;
    22 | delete-vless)
        bash /usr/local/plugins/delete-vless.sh
        ;;
    23 | add-vmess)
        bash /usr/local/plugins/add-vmess.sh
        ;;
    24 | renew-vmess)
        bash /usr/local/plugins/renew-vmess.sh
        ;;
    25 | list-vmess)
        bash /usr/local/plugins/lists-vmess.sh
        ;;
    26 | delete-vmess)
        bash /usr/local/plugins/delete-vmess.sh
        ;;
        # xray
    27 | add-xray)
        bash /usr/local/plugins/add-xray.sh
        ;;
    28 | renew-xray)
        bash /usr/local/plugins/renew-xray.sh
        ;;
    29 | list-xray)
        bash /usr/local/plugins/lists-xray.sh
        ;;
    30 | delete-xray)
        bash /usr/local/plugins/delete-xray.sh
        ;;
        # wireguard
    31 | add-wg)
        bash /usr/local/plugins/add-wg.sh
        ;;
    32 | renew-wg)
        bash /usr/local/plugins/renew-wg.sh
        ;;
    33 | list-wg)
        bash /usr/local/plugins/lists-wg.sh
        ;;
    34 | delete-wg)
        bash /usr/local/plugins/delete-wg.sh
        ;;
        # service
    35 | dropbear)
        bash /usr/local/plugins/dropbear.sh
        ;;
    36 | openvpn)
        bash /usr/local/plugins/openvpn.sh
        ;;
    37 | libev)
        bash /usr/local/plugins/shadowsocks.sh
        ;;
    38 | v2ray)
        bash /usr/local/plugins/v2ray.sh
        ;;
    39 | x2ray)
        bash /usr/local/plugins/x2ray.sh
        ;;
    40 | wireguard)
        bash /usr/local/plugins/wireguard.sh
        ;;
    41 | websocket)
        bash /usr/local/plugins/websocket.sh
        ;;
    42 | squid)
        bash /usr/local/plugins/squid.sh
        ;;
    43 | stunnel)
        bash /usr/local/plugins/stunnel.sh # WARNING
        ;;
        # server
    44 | detail)
        bash /usr/local/plugins/detail.sh # WARNING
        ;;
    45 | tcpbbr)
        bash /usr/local/plugins/tcpbbr.sh
        ;;
    46 | shaper)
        bash /usr/local/plugins/wondershaper.sh
        ;;
    47 | speedtest)
        speedtest
        ;;
    00|quit )
        clear; exit 0
    ;;
    * )
        echo
        echo -e "${ERROR} RALAT ${RESET}${TEXT} Pilihan tidak sah! ${RESET}"
        echo
        menu
    ;;
esac
